package com.bah.tract.model;

import java.util.List;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;

/**
 * @author 524506
 */
@Entity
public class Project {

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + (int) (id ^ (id >>> 32));
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Project other = (Project) obj;
		if (id != other.id)
			return false;
		return true;
	}

	/**
	 * @uml.property name="id"
	 */
	private long id;

	/**
	 * @return
	 * @uml.property name="id"
	 */
	@Id
	@GeneratedValue
	public long getId() {
		return id;
	}

	/**
	 * @param id
	 * @uml.property name="id"
	 */
	public void setId(long id) {
		this.id = id;
	}

	/**
	 * @uml.property name="projectManagers"
	 */
	private List<Person> projectManagers;

	/**
	 * @return
	 * @uml.property name="projectManagers"
	 * @uml.associationEnd  multiplicity="(0 -1)" ordering="true" inverse="person:com.bah.tract.model.Person"
	 */
	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(name = "project_manager", joinColumns = @JoinColumn(name = "project_id"), inverseJoinColumns = @JoinColumn(name = "manager_id"))
	public List<Person> getProjectManagers() {
		return projectManagers;
	}

	/**
	 * @param projectManagers
	 * @uml.property name="projectManagers"
	 */
	public void setProjectManagers(List<Person> projectManagers) {
		this.projectManagers = projectManagers;
	}

	/**
	 * @uml.property name="label"
	 */
	private String label;

	/**
	 * @uml.property name="description"
	 */
	private String description;

	/**
	 * @return
	 * @uml.property name="label"
	 */
	public String getLabel() {
		return label;
	}

	/**
	 * @param name
	 * @uml.property name="label"
	 */
	public void setLabel(String label) {
		this.label = label;
	}

	/**
	 * @return
	 * @uml.property name="description"
	 */
	public String getDescription() {
		return description;
	}

	/**
	 * @param description
	 * @uml.property name="description"
	 */
	public void setDescription(String description) {
		this.description = description;
	}

	private List<WorkStore> workStores;

	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(name = "project_store", joinColumns = @JoinColumn(name = "project_id"), inverseJoinColumns = @JoinColumn(name = "store_id"))
	public List<WorkStore> getWorkStores() {
		return workStores;
	}

	/**
	 *  @uml.property name="workStores"
	 * @param workStores
	 * @uml.associationEnd  multiplicity="(0 -1)" ordering="true" inverse="person:com.bah.tract.model.WorkStore"
	 */
	public void setWorkStores(List<WorkStore> workStores) {
		this.workStores = workStores;
	}
}
